package com.swa99ylum.pjv.sample.s01_nodeframe.s0110;

import com.alibaba.fastjson.JSONPath;
import com.swa99ylum.pjv.sample.FileUtils;

public class Test1 {
	public static void main(String[] args) throws Exception {
		String filePath = Test1.class.getResource("json_0110.txt").getPath();
		
		//step1、获取 json
		String json = null;
		try {
			json = FileUtils.getFileContent(filePath);
		} catch (Exception e) {
			System.err.println("从 文件中，读取 json 有误");
		}
		
		System.out.println(JSONPath.read(json, "$.name[1]")); 
		System.out.println(JSONPath.read(json, "$.name\\[A\\]")); 
		System.out.println(JSONPath.read(json, "$.name\\[1\\]")); 
		
		System.out.println(JSONPath.read(json, "$.name\\{A\\}")); 
		System.out.println(JSONPath.read(json, "$.name\\{1\\}")); 
		
		System.out.println(JSONPath.read(json, "$.name\\(A\\)")); 
		System.out.println(JSONPath.read(json, "$.name\\(1\\)")); 
		
		System.out.println(JSONPath.read(json, "$.name\\[\\.\\.q\\]")); 
		
		System.out.println(JSONPath.read(json, "$.size")); 
		System.out.println(JSONPath.read(json, "$.size1")); 
		
		
	}
}
